// 2025/5/7
// 消减整数

#include <iostream>
using namespace std;

int main() {
    int T, H; cin >> T;
    while(T--)
    {
        cin >> H;
        int ans = 0, cur = 1;
        while(H != 0)
        {
            H -= cur;
            ans++;
            if(H % (cur * 2) == 0)
                cur *= 2;
        }
        cout << ans << endl;
    }
}
// 64 位输出请用 printf("%lld")